main
Sub Main
	dim doc
	Set doc=Application.ActiveDocument
	
	dim args
	args = inputbox("U11/U11.1" ,args,"U11")
	args = ucase(trim(args))	
	dim s,ls,i
	s = split(args,".")
	ls = ubound(s)-lbound(s)+1
	dim oref	
	oref = trim(s(0))	
	
	'if oref = "" then exit sub
	'if isnumeric(oref)=true then exit sub	
	
	dim compobj
	set compobj = doc.components(oref)
	if compobj is nothing then 
		msgbox "wrong input"
	else		
		dim pins,pin
		set pins = compobj.pins
		'msgbox pins.count
		dim ostr,ncount
		ostr =""
		ncount=0
		dim pinname
		'msgbox ls
		select case ls
			case 1
				for each pin in pins
					'msgbox pin.name
					if ostr<>"" then 
						ostr = ostr & ","
					end if
					pinname = replace(pin.name,oref & ".","")
					'msgbox pinname
					ostr = ostr & pinname' pin.name
					ncount = ncount+1
				next
			case 2
				for each pin in pins
					if pin.net.name = trim(ucase(s(1))) then
						if ostr<>"" then 
							ostr = ostr & ","
						end if
						pinname = replace(pin.name,oref & ".","")
						ostr = ostr & pinname' pin.name
						ncount = ncount+1
					end if				
				next
			case else	
				for each pin in pins
					'msgbox pin.name
					if ostr<>"" then 
						ostr = ostr & ","
					end if
					pinname = replace(pin.name,oref & ".","")
					'msgbox pinname
					ostr = ostr & pinname' pin.name
					ncount = ncount+1
				next
		end select
		
		dim ws : set ws = CreateObject("WScript.Shell")
		dim varName : varName = "PADS_SHORTCUT_ROOT"
		dim regPath : regPath ="HKEY_CURRENT_USER\Software\MyApp\PADS\" & varName
		dim varValue : varValue = ws.RegRead(regPath)
		
		dim clipfile,scriptfile
		clipfile = varValue & "\cache\clipboard.txt"
		scriptfile = varValue & "\Skill\includes\CopyToClipboard.vbs"

		
		dim fso,fw
		set fso=createobject("scripting.filesystemobject")
		set fw = fso.createtextfile(clipfile)
		fw.write ostr
		fw.close
		set fw=nothing
		set fso = nothing
		
		dim ocmd
		ocmd =  "cscript " & scriptfile & " " & clipfile
		ws.run ocmd,true
		set ws = nothing

		'Clipboard ostr
		msgbox "copy to clipboard"	
	end if
End Sub

